#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project : gtmsAutoTestProject 
@File    : idle_table_interface.py
@IDE     : PyCharm 
@Author  : Mario
@Date    : 2022/6/15 14:55 
@Describe: POS空闲台位数量接口入口
"""
from fastapi import APIRouter
from FastApi.dto.pos.table.idle_table_dto import IdleTableDtoModel
from FastApi.server.pos.table.idle_table_server import IdleTableServer
from Comm.logUtils.logControl import LogHandler

logger = LogHandler().get_logger()
idleTable_route = APIRouter()


@idleTable_route.post("/idle-table", name="空闲台位")
async def idleTable(payload: IdleTableDtoModel):
    logger.info('请求参数:[{}]'.format(payload))
    idle_table_request = IdleTableServer(payload.brandCode, payload.environment)
    response_data = idle_table_request.get_idle_table()
    logger.info('接口响应:[{}]'.format(response_data))
    return response_data
